#define _CRT_SECURE_NO_WARNINGS
#include"SList.h"

void TestSLT1()
{
    SListNode* plist;
    SListInit(&plist);
    SListPushBack(&plist, 1);
    SListPushBack(&plist, 2);
    SListPushBack(&plist, 3);
    SListPushBack(&plist, 4);
    SListPushBack(&plist, 5);
    SListPrint(plist);

    SListPopBack(&plist);
    SListPrint(plist);
    SListPopBack(&plist);
    SListPrint(plist);
    SListPopBack(&plist);
    SListPrint(plist);
    SListPopBack(&plist);
    SListPrint(plist);
    SListPopBack(&plist);
    SListPrint(plist);
    //SListPopBack(&plist);
    printf("\n");
}

void TestSLT2()
{
    SListNode* plist;
    SListInit(&plist);
    SListPushFront(&plist, 1);
    SListPushFront(&plist, 2);
    SListPushFront(&plist, 3);
    SListPushFront(&plist, 4);
    SListPushFront(&plist, 5);
    SListPrint(plist);

    SListPopFront(&plist);
    SListPrint(plist);
    SListPopFront(&plist);
    SListPrint(plist);
    SListPopFront(&plist);
    SListPrint(plist);
    SListPopFront(&plist);
    SListPrint(plist);
    SListPopFront(&plist);
    SListPrint(plist);
    //SListPopFront(&plist);
    printf("\n");
}
void TestSLT3()
{
    SListNode* plist;
    SListInit(&plist);
    SListPushFront(&plist, 1);
    SListPushFront(&plist, 2);
    SListPushFront(&plist, 3);
    SListPushFront(&plist, 4);
    SListPushFront(&plist, 5);
    SListPrint(plist);

    SListNode* curr = SListFind(plist, 1);
    SListInsert(&plist, 6, curr);
    SListPrint(plist);
    printf("\n");
}

void TestSLT4()
{
    SListNode* plist;
    SListInit(&plist);
    SListPushFront(&plist, 1);
    SListPushFront(&plist, 2);
    SListPushFront(&plist, 3);
    SListPrint(plist);
    SListInsert(&plist, 0, SListFind(plist, 1));
    SListPrint(plist);
    SListInsertAfter(2, SListFind(plist, 1));
    SListPrint(plist);

    SListErase(&plist, SListFind(plist, 3));
    SListPrint(plist);
    SListEraseAfter(SListFind(plist, 1));
    SListPrint(plist);

}

int main()
{
    TestSLT1();
    TestSLT2();
    TestSLT3();
    TestSLT4();
    return 0;
}